<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml" id="html">
    <head>
        <title></title>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <base href="<?= base_url(1); ?>" />
        <link type="text/css" href="css/index.css?v=<?= $config['version'] ?>" rel="stylesheet" />
        <link type="text/css" href="css/main.css?v=<?= $config['version'] ?>" rel="stylesheet" />
        <style type="text/css">
            body{margin:0;padding:0;color:#333;}
            #listarea { background:#fff;width:100%;height:300px;border:1px solid #ddd;overflow:auto}
            #search_list {margin:0;width:auto;}
            #search_list ul li{border-bottom:1px solid #ddd;padding:0 0 5px 0;margin:5px 0;clear:both;height:100%;}
            #search_list ul li em{line-height:20px;overflow: hidden;word-break: keep-all;white-space:nowrap;float:left;overflow: hidden;text-overflow:ellipsis;}
            #search_list ul li em a{margin-right:3px;float:left;color:#005EAC;line-height:20px;}
            #search_list ul li i{margin-right:3px;font-style: normal;}
            #search_list ul li ins{text-decoration: none;display:block;color:#06f;margin:3px 0;overflow: hidden;}
            #search_list ul li b{color:#005EAC;font-weight: normal;}
            #search_list ul li.linkinfo a{margin-right:5px;color:#005EAC;line-height:20px;}
            #search_list ul li.linkinfo a:hover{color:green;}
            #search_list ul li.linkinfo a.log{margin-left:-5px;color:green}
            #search_list ul li.linkinfo a.userdialog{color:green;}
            .userinfo em,.accountinfo em {width:98px;float:left;line-height:17px;}
            .userinfo em.w,.accountinfo em.w{width:196px;}

            #search_list ul li.resultinfo {margin:0;padding:0;}
            .accountinner {background:#EAF6FD}
            .clear {display:block;}
            #search_list ul li em.otherrole {width:100%;clear:both;}
            #search_list ul li em.otherrole a {float:left;width:98px;}
            .ei {cursor:pointer;}
        </style>
    </head>
    <body>
        <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
                <td class="left_txt">
                    <div id="statics">
                        <input type="text" name="keyword" autocomplete="off" /> <?= translate('UID') ?>、<?= translate('NICKNAME') ?>、<?= translate('OPENID') ?>
                    </div>
                </td>
            </tr>
            <tr><td height="10"><div class="line"></div></td></tr>
            <tr><td>
                    <div id="search_list"><ul></ul></div>
                </td>
            </tr>
        </table>
        <script type="text/javascript" src="<?= $config['res_url'] ?>/js/jquery.min.js?ver=<?= $config['version'] ?>"></script>
        <script type="text/javascript" src="<?= $config['res_url'] ?>/js/jquery.datepicker.js?ver=<?= $config['version'] ?>"></script>
        <script type="text/javascript">
            var si, keyword, ai;
            $(function() {
                $("input[name=keyword]").keyup(function() {
                    //如果存在,清除上一个延时操作
                    if (si)
                        clearTimeout(si);
                    keyword = $(this).val();
                    if (keyword == '') {
                        $("#search_list ul").html('');
                    } else {
                        //避免对数据库造成影响，进行一个延时操作
                        si = setTimeout(function() {
                            $.ajax({
                                url: '<?= site_url("common/search") ?>',
                                type: 'POST',
                                data: 'keyword=' + keyword,
                                success: function(data) {
                                    $("#search_list ul").html(data);
                                }
                            });
                        }, 300);
                    }
                });
                $("input[name=keyword]").val(window.parent.$("#headertable").data("keyword"));
                $("input[name=keyword]").focus().keyup();
                $(".userinfo a,.otherrole a").live("click", function() {
                    $("input[name=keyword]").val("id:" + $(this).attr("rel")).keyup();
                });
                $(".linkinfo a.navlink").live("click", function() {
                    window.parent.parent.navadd($(this).text(), $(this).attr("href"));
                    return false;
                });
                $("a.userdialog, .ei").live("click", function() {
                    parent.$.dialog({
                        id: 'edit',
                        title: $(this).attr("title"),
                        width: 635,
                        height: 495,
                        type: 'iframe',
                        content: $(this).attr("href"),
                        style: 'no_button'
                    });
                    return false;
                });
                $(".linkinfo a:not([class])").live('click', function() {
                    window.parent.parent.navadd($(this).attr("title"), $(this).attr("href"));
                    return false;
                });
                //快捷键
                $(document).bind('keydown', function(e) {
                    e = e || window.event;
                    if (e.keyCode == 27) {
                        $(window.parent.frames['left']).focus();
                        $(window.parent.frames['left'].document).find(".e").fadeIn();
                    } else if (e.keyCode == 113) {
                        window.parent.search();
                    }
                });
                $(document).bind('keypress', function(e) {
                    if (e.ctrlKey && e.which == 13 || e.which == 10) {

                    } else if (e.shiftKey && e.which == 13 || e.which == 10) {

                    } else if (e.shiftKey && e.which == 90) {
                        window.parent.search();
                    }
                });
                $("#ftsubmit").live("click", function() {
                    if ($("#fttime").val() != '') {
                        $.ajax({
                            url: $(this).attr("rel"),
                            dataType: 'json',
                            data: 'title=' + $(this).attr("t") + "&time=" + $("#fttime").val(),
                            success: function(ret) {
                                if (ret.code != undefined) {
                                    if (ret.code == 1) {
                                        $(".ft").remove();
                                        window.parent.SG.admin.success("<?= translate('C_TIPS_SUCCESS_TEXT') ?>");
                                        window.parent.SG.admin.refresh();
                                        if (ret.result.length >= 4 && typeof ret.result == "object") {
                                            window.top.async(ret.result[0], ret.result[1], ret.result[2], ret.result[3]);
                                        }
                                    } else {
                                        window.parent.SG.admin.error(ret.result);
                                    }
                                }
                            },
                            error: function(ret) {
                                window.parent.SG.admin.error(ret.result);
                            }
                        });
                    } else {
                        window.parent.SG.admin.error("<?= translate('COMMON_SEARCH_SEL_DATE') ?>");
                    }
                });
                $(".forbidden_words").live("click", function() {
                    $(".ft").remove();
                    $("<span class='ft' style='float:left;'><input type='text' id='fttime' class='datepicker' placeholder='<?= translate('COMMON_SEARCH_UNFORBIDDEN') ?>' /><input type='button' id='ftsubmit' value='<?= translate('SUBMIT') ?>' rel='" + $(this).attr("href") + "' t='" + $(this).attr("title") + "' /></span>").insertAfter($(this));
                    $(".datepicker").datepicker({showtime: true});
                    return false;
                });
            });
            function loadinfo(url, data) {
                //避免出现发送多余的请求
                clearTimeout(ai);
                ai = setTimeout(function() {
                    $.ajax({
                        type: "POST",
                        data: data,
                        url: url,
                        dataType: 'json',
                        timeout: 5000,
                        success: function(ret) {
                            var str = '';
                            if (ret && typeof ret == 'object' && ret.code == 1 && typeof ret.result == 'object') {
                                var u = ret.result;
                                str = '<em><i><?= translate('UID') ?></i><b>' + u.id + '</b></em><em><i>VIP</i><b>' + u.vip + '</b></em>';
                                str += '<em><i><?= translate('STATUS') ?></i><b><font color="gray">' + (u.socketid != 0 ? '<?= translate('ONLINE') ?>' : '<?= translate('OFFLINE') ?>') + '</font></b></em><em><i><?= translate('CAMP') ?></i><b>' + u.campId + '</b></em><em><i><?= translate('GANG') ?></i><b>' + u.gangId + '</b></em>';
                                str += '<em><i><?= translate('COMMON_SEARCH_STRENGTH') ?></i><b>' + u.strength + '</b></em><em><i><?= translate('COMMON_SEARCH_LOCATION') ?></i><b>' + u.location + '</b></em>';
                                str += '<em><i><?= translate('COMMON_SEARCH_MASTER') ?></i><b>' + u.master + '</b></em>';
                                str += '<em><i><?= translate('LEVEL') ?></i><b>' + u.level + '</b></em><em><i><?= translate('EXP') ?></i><b>' + u.exp + '</b></em><em><i><?= translate('GOLD') ?></i><b>' + u.gold + '</b></em><em><i><?= translate('COPPER') ?></i><b>' + u.copper + '</b></em><em><?= translate('REMAINHP') ?></i><b>' + u.id + '</b></em>';
                                str += '<em><i><?= translate('PHYSICAL') ?></i><b>' + u.physical + '</b></em><em><i><?= translate('ENDURANCE') ?></i><b>' + u.endurance + '</b></em><em><i><?= translate('GESTE') ?></i><b>' + u.geste + '</b></em><em><i><?= translate('COMMON_SEARCH_LOGINS') ?></i><b>' + u.logins + '</b></em>';
                                str += '<em><i><?= translate('COMMON_SEARCH_PLAYTATTOOS') ?></i><b>' + u.playtattoos + '</b></em><em><i><?= translate('COMMON_SEARCH_SUCCESSIONS') ?></i><b>' + u.successions + '</b></em><em><i><?= translate('COMMON_SEARCH_SIGNINS') ?></i><b>' + u.signins + '</b></em><em><i><?= translate('COMMON_SEARCH_GUESSNUMWINS') ?></i><b>' + u.guessnumwins + '</b></em><em><i><?= translate('GOLDS') ?></i><b>' + u.golds + '</b></em>';
                                str += '<em><i><?= translate('COMMON_SEARCH_BAIHUANS') ?></i><b>' + u.baihuans + '</b></em><em><i><?= translate('COMMON_SEARCH_SLAVES') ?></i><b>' + u.slaves + '</b></em>';
                                str += '<em class="w"><i><?= translate('COMMON_SEARCH_FORBIDDENTIME') ?></i><b>' + u.forbiddentime + '</b></em>';
                                str += '<em class="w"><i><?= translate('COMMON_SEARCH_ACTIVETIME') ?></i><b>' + u.activetime + '</b></em>';
                                str += '<em class="w"><i><?= translate('COMMON_SEARCH_GUESSNUMS') ?></i><b>' + u.guessNums + '</b></em>';
                                str += '<em class="w"><i><?= translate('COMMON_SEARCH_ROLEINDEX') ?></i><b>' + u.roleindex + '</b></em>';
                                str += '<em class="w"><i><?= translate('COMMON_SEARCH_JOINIP') ?></i><b>' + u.joinip + '</b></em><em class="w"><i><?= translate('COMMON_SEARCH_LOGINIP') ?></i><b>' + u.loginip + '</b></em>';
                            } else {
                                str = "<font color=red><?= translate('COMMON_SEARCH_LOAD_FAILURE') ?></font>";
                            }
                            $("#detailinfo").html(str);
                        },
                        error: function(e) {
                            $("#detailinfo").html("<font color=red><?= translate('COMMON_SEARCH_LOAD_FAILURE') ?></font>");
                        }
                    });
                }, 1000);
            }
        </script>
    </body>
</html>